package com.gx.smart.building.ui.knowledge.model

import android.os.Parcel
import android.os.Parcelable

/**
 * @author: xiaosy
 * 时间: 2022/4/11
 * @Description: java类作用描述
 * @Version: 1.0
 */
data class KnowledgeType(var id: String?, var name: String?, var children: List<KnowledgeType>?):
    Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readString(),
        parcel.readString(),
        parcel.createTypedArrayList(CREATOR)
    )

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(id)
        parcel.writeString(name)
        parcel.writeTypedList(children)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<KnowledgeType> {
        override fun createFromParcel(parcel: Parcel): KnowledgeType {
            return KnowledgeType(parcel)
        }

        override fun newArray(size: Int): Array<KnowledgeType?> {
            return arrayOfNulls(size)
        }
    }
}